package cn.globalph.housekeeper.data.source

import android.content.Context
import android.content.SharedPreferences
import cn.globalph.housekeeper.data.SP_PH_DATA
import com.google.gson.Gson

const val ALARM_DATA = "alarm_data"
class PreferenceManager {
    companion object{
        private val gson = Gson()

        private fun preference(context: Context): SharedPreferences {
            return context.getSharedPreferences(SP_PH_DATA, Context.MODE_PRIVATE)
        }

        private fun edit(context: Context): SharedPreferences.Editor{
            return preference(context).edit()
        }

        fun getAlarmData(context: Context):String?{
            return preference(context).getString(ALARM_DATA,"")
        }

        fun saveAlarmData(context: Context,data:String){
            edit(context).putString(ALARM_DATA,data).apply()
        }
    }
}